<script>
// import { mapActions, mapGetters, mapMutations, mapState } from "vuex";
import { mapMutations } from "vuex";
import { handleLogin } from "@/api/index";

export default {
  data() {
    return {};
  },
  created() {
    this.login();
  },
  computed: {
    // ...mapState("user", ["userInfo"]),
    // ...mapGetters("user", ["userInfo"]),
  },
  methods: {
    ...mapMutations("user", ["SET_USER_INFO"]),
    // ...mapActions("user", ["SET_USER_INFO"])
    async login() {
      const res = await handleLogin({
        username: "admin",
        password: "123456",
      });
      this.SET_USER_INFO(res);
      console.log(res, "登录成功");
    },
  },
};
</script>

<template>
  <div>
    <div>home</div>
  </div>
</template>

<style scoped lang="scss">
img {
  width: 100px;
  height: 100px;
}
</style>
